<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>贪吃蛇小游戏</title>

    <style>
        body {
            margin: 0px;
            padding: 0px;
        }
        #main {
            margin:100px;
        }
        .btn {
            width: 100px;
            height: 40px;
        }
    </style>
</head>

<body>
    <div id="main">
        <input class="btn" type="button" value="暂停游戏" id="pause" />
        <input class="btn" type="button" value="开始游戏" id="begin" />
    </div>
    <script>
        btn=document.getElementsByClassName("btn");
        var flag=true;
        if (flag){
            btn.style.backgroundColor=red;
        }
    </script>
</body>

</html>